﻿@model IEnumerable<tutors_clus.Models.student>

@{
    ViewBag.Title = "Danh sách hoc sinh";
    Layout = "~/Views/Shared/_Layout_Private.cshtml";
}
<div id="cleft">@Html.Partial("_menu_admin")</div>
<div id="cright">
@{Html.RenderAction("Search_student", "Admin");}
<div id="print">
<h3>Danh sách học sinh</h3>

<table id="testTable">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.fullname_stu)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.birthday_stu)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.address_stu)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.registered_stu)
        </th>
        <th>
            Danh mục lớp đã tham gia
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.fullname_stu)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.birthday_stu)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.address_stu)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.registered_stu)
        </td>
        <td class="class">
            <ul>
             @foreach (var t in @item.student_course)
             {
                 <li>@t.course.name_cou</li>
             }
             </ul>
        </td>
    </tr>
}

</table>
        </div>
    <div class="ExportExcel"><input  type="submit" name="Export" id="Export" value="Kết xuất danh sách sang Excel"/></div>
</div>
<script>
    $("#Export").click(function (e) {
        window.open('data:application/vnd.ms-excel,' + encodeURIComponent($('#print').html()));
        e.preventDefault();
    })
</script>